/**
 * Created by ZhaoJinBing on 2017/8/4.
 */
require.config({
    baseUrl: './assets/',
    map:{
        '*':{
            'css': 'vendors/requirejs/css'
        }
    },
    paths: {
        'jquery': 'vendors/jquery/dist/jquery',
        'easyui': 'vendors/jquery-easyui/jquery.easyui.min',
        'easyui_zh_CN': 'vendors/jquery-easyui/locale/easyui-lang-zh_CN',
        'layer': 'vendors/layer/layer',
        'form': 'js/common/form',
        'dialog': 'js/common/dialog'
    },
    shim: {
        'easyui': {
            deps: ['css!vendors/jquery-easyui/themes/default/easyui.css',
                'css!vendors/jquery-easyui/themes/icon.css',
                'jquery']
        },
        'layer': {
            deps: ['css!vendors/layer/skin/default/layer.css', 'jquery']
        }
    }
});

require(['jquery', 'easyui_zh_CN', 'form', 'dialog'], function ($, easyuiZhCN, form, dialog) {
    easyuiZhCN.init();
    var loginDialogSetting = {
        width: 500,
        height: 220,
        title: '登录',
        modal: true,
        style: 'padding:10px;'
    };

    var dialog = dialog.create(loginDialogSetting);

    var loginFormSetting = {
        url: './login',
        method: 'POST',
        style: 'margin-top: 15px',
        appendTo: dialog,
        items: [
            {
                type: 'textbox',
                name: 'username',
                id: 'username',
                option: {
                    iconCls: 'icon-man',
                    iconAlign: 'right',
                    prompt: '请输入用户名',
                    required: true,
                    validType: ['length[5, 20]'],
                    value: 'admin'
                }
            }, {
                type: 'passwordbox',
                name: 'password',
                id: 'password',
                option: {
                    prompt: '请输入密码',
                    required: true,
                    validType: ['length[5, 20]'],
                    value: 'qwer1234'
                }
            }
        ],
        btns: ['submit["登录"]', 'reset']
    };
    form.create(loginFormSetting, function () {
        window.location.href = './';
    });

});
